package edu.univercidade.tcc.server.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.FetchType;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.tostring.RooToString;

@RooJavaBean
@RooToString
@RooEntity
public class ProjectRole {

    @NotNull
    @Size(max = 30)
    private String name;

    @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    private Set<Permission> permissions = new HashSet<Permission>();

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy="projectRole")
    private Set<Workflow> workflows = new HashSet<Workflow>();

    @Override
    public String toString() {
        return name;
    }
}
